import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:get/get_core/src/get_main.dart';
import 'package:personinfo/states/appController.dart';

import '../../utils/ColorUtil.dart';
import '../../utils/commonUtil.dart';
import '../../widgets/common/CommonWidget.dart';
import '../../widgets/common/Vanfeild.dart';

class Setting extends StatefulWidget{
  const Setting({super.key});

  @override
  State<StatefulWidget> createState()=> _Setting();

}

class _Setting extends State<Setting>{
  AppController app = Get.put(AppController());

  @override
  Widget build(BuildContext context) {
   return Scaffold(
        backgroundColor: Theme.of(context).colorScheme.onPrimary,
        appBar: commonWidget.appBar(
            leading: GestureDetector(onTap: (){Navigator.pop(context);},child: const Icon(Icons.keyboard_arrow_left),),
            title: const Text("设置"),
        ),
      body: SingleChildScrollView(
          child: Container(
            padding: EdgeInsets.fromLTRB(16, 10, 16, 10),
            child: Column(
              children: [
                Vanfeild(labelText: '微购汽车介绍',placeholder:""),
                Vanfeild(labelText: '微购汽车介绍',placeholder:""),
                Vanfeild(labelText: '客服电话',showIcon: false, val: "600-681-6811",
                    onTap: ()=>commonUtil.callPhone("600-681-6811")
                ),
                Vanfeild(labelText: '法律意见',placeholder:""),
                Vanfeild(labelText: '意见反馈',placeholder:""),
                Vanfeild(labelText: '检查新版本',placeholder:""),
                const SizedBox(height: 40,),

                SizedBox(
                  width: double.infinity,
                  height: 44,
                  child: ElevatedButton(
                    style: ElevatedButton.styleFrom(
                        backgroundColor: ColorUtil.primaryBgColor
                    ),
                    child: const Text(
                      "退出",
                      style: TextStyle(fontSize: 20, color: Colors.white),
                    ),
                    onPressed: () {
                      app.logout();
                      // Navigator.pushNamed(context, "/login");
                      Navigator.pushReplacementNamed(context, "/login");
                    },
                  ),
                )
              ],
            ),
          ),
      ),
     );
  }

}